//
//  QLUserManager.h
//  WeiMiLan
//
//  Created by anan on 14/11/23.
//  Copyright (c) 2014年 Mac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "QLPublic.h"

@interface QLUserManager : NSObject<UIAlertViewDelegate>

@property (nonatomic,strong) NSMutableDictionary *userInfos;

+ (QLUserManager*)shareInstance;

//校验手机号码格式
+ (BOOL)isMobileNumber:(NSString *)mobileNum;

//校验邮箱格式
+ (BOOL)isEmailAddress:(NSString*)email;

//保存登录用户信息，同时保存为最后用户
- (void)saveUserInfo:(NSDictionary*)userInfo;

//本地获取登录用户信息
- (NSDictionary*)getUserInfoFromNative;
    
//获取后的用户信息，可能是系统生成的用户
- (NSDictionary*)getLastUserInfoFromNative;

//保存最后的用户信息
- (void)saveLastUserInfo:(NSDictionary*)dic;

//用户注销，保留系统自动生成的用户
- (void)userLogout;

/**
 *  判断是不是登陆用户
 *
 *  @return
 */
- (BOOL)isLoginUser;

/**
 *  显示登陆窗口
 *
 *  @param block
 */
- (void)showLoginDialog;

- (void)detailWithUserId:(int)userId callback:(QLHttpResultBlock)callback;

- (void)updateWithUserId:(int)userId phone:(NSString*)phone name:(NSString*)name headerUrl:(NSString*)headerUrl callback:(QLHttpResultBlock)callback;

- (void)users:(NSArray*)list callback:(QLHttpResultBlock)callback;

- (NSString*)userNameWithUserId:(NSString*)userId;

- (NSString*)userHeaderWithUserId:(NSString*)userId;

@end
